let s = '(([{}])'
var isValid = function(s) {
  const obj = {
      '(': ')',
      '[': ']',
      '{': '}'
  }
  const stk = []
  for (let i = 0; i < s.length; i++) {
      if (s[i] === '(' || s[i] === '[' || s[i] === '{') {
          stk.push(s[i])
      } else {
          if (!stk.length || obj[stk.pop()] !== s[i]) return false
      }
  }
  return !stk.length

  // if (stk.length) return false
  // return true
}

console.log(isValid(s));
